#ifndef __link_h__
#define __link_h__

#include <string>
#include <vector>

// INPUT: Input from arena or other model.
// PARAMETER: Fitted value (target etc).
// OUTPUT: Result of calculation (acceleration form force etc). Not used for error calculation
enum Link_type { INPUT, PARAMETER, OUTPUT };

class Predictor_base;

class Predictor_link
{
 public:
  Predictor_link(Link_type link_type);
  ~Predictor_link();

  void set_source( Predictor_base *p );
  void add_target( Predictor_base *p );

  void activate( void );
  void deactivate( void );

  float get_value( void );

  Link_type get_link_type(void);

  void set_value( float v );

  bool active( void );

  void reset( void );

 private:
  std::vector<Predictor_base *> _targets;

  // If _source is in _targets, then that predictor is
  // the owner of this link and can set _value
  Predictor_base *_source;

  Link_type _link_type;

  float _value;
  float _simulated_value;
  bool _active;
};

#endif
